var data = [
    { "ID": "B01", "BoatNo": "HUAYUAN001", "BoatName": "华远001", "Status": "在气田" },
    { "ID": "02", "BoatNo": "HYSY685", "BoatName": "海洋石油685", "Status": "返航途中" },
    { "ID": "03", "BoatNo": "HYSY651", "BoatName": "海洋石油651", "Status": "在港" },
    { "ID": "04", "BoatNo": "DETAO", "BoatName": "德涛", "Status": "返航途中" },
    { "ID": "05", "BoatNo": "DEPEI", "BoatName": "德沛", "Status": "在气田" }
];

// 用户ID
let id = getUrlParam("id");
$(function () {
    GetUserRole();
});
//获取用户权限
function GetUserRole() {
    // let thisdata = [];
    // thisdata.push(InitRole(id));
    let USERdata = InitRole(id);
    if (USERdata != null) {
        choose('sh');
        InitData('sh');
    }
    else OpenErrmsg("../../web/errhtml/404.html");
}
let path = getDataPath();
function choose(type) {
    $('#btn_sh').removeClass("labelstyleChoose labelstyle");
    $('#btn_fj').removeClass("labelstyleChoose labelstyle");

    $('#btn_sh').addClass(type == "sh" ? "labelstyleChoose" : "labelstyle");
    $('#btn_fj').addClass(type == "fj" ? "labelstyleChoose" : "labelstyle");
    InitData(type);
}
function InitData(type) {
    let workType =''
    if (type == "sh") {
        workType = "守护船"
    }else{
        workType = "飞机"
    }
    let url = ''
    url = path + '/ls172/indexInfo/getShipDynamic'
    var params = {
        "endTime": "",
        "name": "",
        "pageNum": 1,
        "pageSize": 15,
        "startTime": "",
        "workType": workType
    }
    $.ajax({
        url: url,
        type: "post",
        async: false,
        dataType: "json",
        headers: {
            Accept: "application/json",
            "Content-Type": "application/json"
        },
        data: JSON.stringify(params),

        success: function (data) {
            data = data.data.records
            $('#dg_WorkPlanList').datagrid({
                data: data,
                onLoadSuccess: function (data) {
                    $("#tb01").css("background-color", "white");
                }
            });
        },
        error: function (data) {
            console.log("code", data);
        }
    });

}

